package com.znsd.zl.address.controller;

import com.znsd.zl.address.service.IAddressService;
import com.znsd.zl.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @ClassName AddressConroller
 * @Description TODO
 * @Author jbb
 * @Date 2020/8/26 17:35
 * @Version v1.0
 */
@RestController
@RequestMapping("/address")
public class AddressController {

    @Autowired
    private IAddressService service;

    @GetMapping("/list")
    public R find(@RequestParam String province,@RequestParam String city){
        return R.ok().put("address",service.findAddressByProvince(province,city));
    }

    @GetMapping("/province")
    public R findProvince(@RequestParam String province){
        return R.ok().put("province",service.findProvince(province));
    };

    @GetMapping("/city")
    public R findCity(@RequestParam String city){
        return R.ok().put("city",service.findCity(city));
    };

    @GetMapping("/districtList")
    public R findAllDistrictByCityName(@RequestParam String city){
        return R.ok().put("districtList",service.findAllDistrictByCityName(city));
    };




}
